package publics.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="loan_card")
public class LoanCard {//企业贷款卡
	
	 private Integer cardId;// ID,     int not null,
     private Enterprise ent;
	 private String creditorBank;//债权银行   varchar(20) not null,
	 private Float remain;//贷款余额（元）     Float not null,
	 
	 private LoanType loanType;
//	 private String way;//贷款方式        varchar(10) not null,
	 private Date borrowDate;//借款日期     Date not null,
	 private Date repayDate;//到期日期      date not null,
	 private Float interestRate;//利率   Float not null,
	 private Float amount3thYear; //近3年累计借款（元）   Float not null,
	 private Float repayedSum ;//累计归还（元）   Float not null,
	 private Float repayedRate;//到期偿还率    Float,
	 private String remarks;//备注        varchar(50),
	 @Id
	 @GeneratedValue
	 @Column(name="Loan_card_id")
	public Integer getCardId() {
		return cardId;
	}
	 @ManyToOne(fetch=FetchType.LAZY)
	 @JoinColumn(name="Ent_id",nullable=false)
	public Enterprise getEnt() {
		return ent;
	}
	 @Column(name="Loan_creditor_bank")
	public String getCreditorBank() {
		return creditorBank;
	}
	 @Column(name="Loan_remain")
	public Float getRemain() {
		return remain;
	}
//	 @Column(name="Loan_type")
//	public String getWay() {
//		return way;
//	}
	 @ManyToOne
	 @JoinColumn(name="Loan_type",nullable=false)
	 public LoanType getLoanType() {
		return loanType;
	}

	@Column(name="Loan_borrow_date")
	public Date getBorrowDate() {
		return borrowDate;
	}
	 @Column(name="Loan_repay_date")
	public Date getRepayDate() {
		return repayDate;
	}
	 @Column(name="Loan_interest_rate")
	public Float getInterestRate() {
		return interestRate;
	}
	 @Column(name="Loan_amount_3year")
	public Float getAmount3thYear() {
		return amount3thYear;
	}
	 @Column(name="Loan_repayed_sum")
	public Float getRepayedSum() {
		return repayedSum;
	}
	 @Column(name="Loan_repayed_rate")
	public Float getRepayedRate() {
		return repayedRate;
	}
	 @Column(name="Loan_remarks")
	public String getRemarks() {
		return remarks;
	}
	public void setCardId(Integer cardId) {
		this.cardId = cardId;
	}
	public void setEnt(Enterprise ent) {
		this.ent = ent;
	}
	public void setCreditorBank(String creditorBank) {
		this.creditorBank = creditorBank;
	}
	public void setRemain(Float remain) {
		this.remain = remain;
	}
//	public void setWay(String way) {
//		this.way = way;
//	}
	public void setLoanType(LoanType loanType) {
		this.loanType = loanType;
	}
	public void setBorrowDate(Date borrowDate) {
		this.borrowDate = borrowDate;
	}
	public void setRepayDate(Date repayDate) {
		this.repayDate = repayDate;
	}
	public void setInterestRate(Float interestRate) {
		this.interestRate = interestRate;
	}
	public void setAmount3thYear(Float amount3thYear) {
		this.amount3thYear = amount3thYear;
	}
	public void setRepayedSum(Float repayedSum) {
		this.repayedSum = repayedSum;
	}
	public void setRepayedRate(Float repayedRate) {
		this.repayedRate = repayedRate;
	}
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
 
	public LoanCard() {
		super();
		// TODO Auto-generated constructor stub
	}
	
	
	public LoanCard(Integer cardId, String creditorBank, Float remain,
			LoanType loanType, Date borrowDate, Date repayDate,
			Float interestRate, Float amount3thYear, Float repayedSum,
			Float repayedRate, String remarks) {
		super();
		this.cardId = cardId;
		this.creditorBank = creditorBank;
		this.remain = remain;
		this.loanType = loanType;
		this.borrowDate = borrowDate;
		this.repayDate = repayDate;
		this.interestRate = interestRate;
		this.amount3thYear = amount3thYear;
		this.repayedSum = repayedSum;
		this.repayedRate = repayedRate;
		this.remarks = remarks;
	}
	
	public LoanCard(Integer cardId, Enterprise ent, String creditorBank,
			Float remain, LoanType loanType, Date borrowDate, Date repayDate,
			Float interestRate, Float amount3thYear, Float repayedSum,
			Float repayedRate, String remarks) {
		super();
		this.cardId = cardId;
		this.ent = ent;
		this.creditorBank = creditorBank;
		this.remain = remain;
		this.loanType = loanType;
		this.borrowDate = borrowDate;
		this.repayDate = repayDate;
		this.interestRate = interestRate;
		this.amount3thYear = amount3thYear;
		this.repayedSum = repayedSum;
		this.repayedRate = repayedRate;
		this.remarks = remarks;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "LoanCard [amount3thYear=" + amount3thYear + ", borrowDate="
				+ borrowDate + ", cardId=" + cardId + ", creditorBank="
				+ creditorBank + ", ent=" + ent + ", interestRate="
				+ interestRate + ", loanType=" + loanType + ", remain="
				+ remain + ", remarks=" + remarks + ", repayDate=" + repayDate
				+ ", repayedRate=" + repayedRate + ", repayedSum=" + repayedSum
				+ "]";
	}
	
	  
	 
	
}
